/*************************************************************************
	> File Name: P1287.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-01-06 14:23:48
 ************************************************************************/
#include <iostream>
using namespace std;

#define MAX_N 100

int dp[MAX_N + 5][MAX_N + 5];

int fac(int n) {
    if (n == 1) return 1;
    return fac(n - 1) * n;
}

int main() {
    int n, r;
    cin >> n >> r;
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= r; j++) {
            dp[i][j] = dp[i - 1][j - 1] + j * dp[i - 1][j];
        }
    }
    cout << dp[n][r] * fac(r);
    return 0;
}
